#ifndef SYMBOLS_H
#define SYMBOLS_H

#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>  // 添加pid_t定义

// 符号信息结构
typedef struct {
    char name[256];
    uintptr_t address;
    char filename[256];
    unsigned int line;
} symbol_info_t;

// 符号表结构
typedef struct symbol_table_s {
    symbol_info_t *symbols;
    size_t count;
    size_t capacity;
} symbol_table_t;

// 函数声明
symbol_table_t* symbol_table_create(void);
void symbol_table_destroy(symbol_table_t *table);
int symbol_table_load_from_program(symbol_table_t *table, const char *program_path);
uintptr_t symbol_table_find_address(symbol_table_t *table, const char *symbol_name);
int symbol_table_find_symbol_by_address(symbol_table_t *table, uintptr_t address, 
                                       char *symbol_name, size_t name_size);

// 进程相关的符号查找（支持函数和全局变量）
uintptr_t find_function_address_in_process(pid_t pid, const char *program_path, const char *symbol_name);

#endif // SYMBOLS_H